import 'package:flutter/material.dart';

import 'package:get/get.dart';
import 'package:getx_learn/app/common/widgets/widgets.dart';
import 'package:getx_learn/generated/locales.g.dart';

import '../controllers/language_demo_controller.dart';

class LanguageDemoView extends GetView<LanguageDemoController> {

  const LanguageDemoView({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {

    return Scaffold(
      appBar: getAppBar(context: context, title: Get.arguments),
      body:  Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            Text(LocaleKeys.hello.tr, style: TextStyle(color: Colors.pink, fontSize: 30)),
            ElevatedButton(
                onPressed: () => controller.changeLanguage('zh', "CN"),
                child: Text("切换到中文")
            ),
            SizedBox(height: 20,),
            ElevatedButton(
                onPressed: () => controller.changeLanguage('en', "US"),
                child: Text("切换到英文")
            ),
          ],
        ),
      ),
    );
  }
}
